package com.doitedu.day03.funcs

import scala.io.Source

/**
 * @Date 22.6.22
 * @Created by HANGGE
 * @Description
 */
object _08MapValues {
  def main(args: Array[String]): Unit = {
    /*   val mp = Map[String,Int]("a"->1 , "b"->2,"c"->3)
      // mp.map(tp=>(tp._1 , tp._2*10)).foreach(println)
      val res: Map[String, Int] = mp.mapValues(_ * 10)
       res.foreach(println)*/
    Source
      .fromFile("e://words.txt")
      .getLines()
      .flatMap(_.split("\\s+"))
      .toList
      .groupBy(e => e)
      .mapValues(_.size)
      .toList
      .sortBy(-_._2)
      .foreach(println)


  }

}
